import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path:"/login",
    component:()=>import("@/pages/login.vue")
  },
  {
    path:"/index",
    component:()=>import("@/pages/index.vue"),
    //二级路由不加/
    children:[
      {
        path:"home",
        component:()=>import("@/views/home/home.vue"),
        meta:{title:"首页"}
      },
      {
        path:"menu",
        component:()=>import("@/views/menu/menu.vue"),
        meta:{title:"菜单管理"}
      },
      {
        path:"role",
        component:()=>import("@/views/role/role.vue"),
        meta:{title:"角色管理"}
      },
      {
        path:"user",
        component:()=>import("@/views/user/user.vue"),
        meta:{title:"管理员管理"}
      },
      {
        path:"",
        redirect:"home"
       }
    ]
  },
  //重定向
 {
  path:"*",
  redirect:"/login"
 }
]




const router = new VueRouter({
  routes
})

export default router
